1. Field of the Invention
The present invention relates to a computer program product, an apparatus, and a method of optimizing a Java object as a constant object.
2. Description of the Related Art
In Java (Registered Trademark), which is an object-oriented language, the JVM (Java Virtual Machine) can be used to compile byte code of a Java program written in an intermediate language into native code instead of executing the byte code via an interpreter. The native code can be directly executed by a processor, where the program can be executed at higher speed.
When JVM compiles byte code, optimization can often be processed on the condition that the value of the object accessed by the byte code remains constant for a certain period of time. JVM processes such optimization, and disables the optimization when it detects a writing to the object. In such a case, the detection of writing by using software involves high operation cost. Further, the detection of writing by using a page protection system causes a problem of attribute-change cost for changing the attribute of an area back into a rewritable state and thus causing a problem of accompanied cost for suspending a thread (refer to U.S. Patent Application No. 2006/0155791 and Ajeet Shankar et al., “Runtime Specialization With Optimistic Heap Analysis,” OOPSLA '05, Oct. 16-20, 2005, San Diego, Calif., USA).